from typing import Any, Callable, List, NamedTuple, Optional


class Case(NamedTuple):
    """
    条件分支，每次调用pipe之前执行
    """

    when: Callable[[Any], bool]
    """检查输入参数data是否满足条件"""
    then: Optional[List[Callable[..., Any]]] = None
    """满足条件时执行"""
    otherwise: Optional[List[Callable[..., Any]]] = None
    """不满足条件时执行"""
